package com.forum.article.controller;


import com.forum.article.service.ForumArticleCommentService;
import com.forum.article.service.ForumCommentService;
import com.forum.article.vo.Result;
import com.forum.article.vo.param.CommentParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bncgnc
 * @since 2022-01-04
 */
@RestController
@RequestMapping("/article/forumComment")
public class ForumCommentController {

    @Autowired
    ForumCommentService forumCommentService;

    //评论列表
    @GetMapping("comments/{id}")
    public Result comments(@PathVariable("id") Long id){
        return forumCommentService.commentByArticleId(id);

    }

    //评论
    @PostMapping("create/change")
    public  Result comment(@RequestBody CommentParam commentParam){

        return forumCommentService.comment(commentParam);
    }

}

